package com.cyx.proxy;

public class Client {
    public static void main_static(String[] args) {
        Landlord landlord = new Landlord();
        //静态代理
        HouseAgent proxy = new HouseAgent();
        proxy.setRent(landlord);
        proxy.rentHourse();
    }

    public static void main_1(String[] args) {
        Landlord landlord = new Landlord();
        DynamicProxyRent proxyRent = new DynamicProxyRent();
        proxyRent.setDelegate(landlord);
        IRent rent = (IRent) proxyRent.getProxy();
        rent.rentHourse();
    }

    public static void main(String[] args) {
        Landlord landlord = new Landlord();
        Object proxy = DynamicProxy.getProxy(landlord);
        System.out.println(proxy);
        ((IRent)proxy).rentHourse();
    }
}
